//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
/*
 * Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany
 * Copyright 1992 by David Dawes <dawes@XFree86.org>
 * Copyright 1992 by Jim Tsillas <jtsilla@damon.ccs.northeastern.edu>
 * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
 * Copyright 1992 by Robert Baron <Robert.Baron@ernst.mach.cs.cmu.edu>
 * Copyright 1992 by Orest Zborowski <obz@eskimo.com>
 * Copyright 1993 by Vrije Universiteit, The Netherlands
 * Copyright 1993 by David Wexelblat <dwex@XFree86.org>
 * Copyright 1994, 1996 by Holger Veit <Holger.Veit@gmd.de>
 * Copyright 1994, 1995 by The XFree86 Project, Inc
 *
 * Permission to use, copy, modify, distribute, and sell this software and its
 * documentation for any purpose is hereby granted without fee, provided that
 * the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the names of the above listed copyright holders 
 * not be used in advertising or publicity pertaining to distribution of 
 * the software without specific, written prior permission.  The above listed
 * copyright holders make no representations about the suitability of this 
 * software for any purpose.  It is provided "as is" without express or 
 * implied warranty.
 *
 * THE ABOVE LISTED COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD 
 * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
 * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDERS BE 
 * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 
 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 
 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 
 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */

#ifndef _XF86_OSPROC_H
#define _XF86_OSPROC_H

/*
 * The actual prototypes have been pulled into this seperate file so
 * that they can can be used without pulling in all of the OS specific
 * stuff like sys/stat.h, etc. This casues problem for loadable modules.
 */ 

/* The Region arg to xf86[Un]Map* */
#define NUM_REGIONS 4
#define VGA_REGION 0
#define LINEAR_REGION 1
#define EXTENDED_REGION 2
#define MMIO_REGION 3

#ifndef NO_OSLIB_PROTOTYPES
/*
 * This is to prevent re-entrancy to ErrorF() when aborting.
 * Anything that can be called as a result of AbortDDX() should use this
 * instead of ErrorF(). (xf86Exiting gets set to TRUE the first time
 * AbortDDX() is called.)
 */

extern Boolean xf86Exiting;

#define xf86FatalError(a, b) \
    if (xf86Exiting) { \
        ErrorF(a, b); \
        return; \
    } else ErrorF(a, b)

/***************************************************************************/
/* Prototypes                                                              */
/***************************************************************************/

#include <Xfuncproto.h>

_XFUNCPROTOBEGIN

/* xf86_Util.c */
extern int StrCaseCmp(
    const char *,
    const char *
);

/* OS-support layer */
extern void xf86OpenConsole(
    void
);
extern Boolean xf86VTSwitchPending(
    void
);
extern Boolean xf86VTSwitchAway(
    void
);
extern Boolean xf86VTSwitchTo(
    void
);
extern Boolean xf86LinearVidMem(
    void
);
extern pointer xf86MapVidMem(
    int,
    int,
    pointer,
    unsigned long
);
extern void xf86UnMapVidMem(
    int,
    int,
    pointer,
    unsigned long
);

extern void xf86MapDisplay(
    int,
    int
);
extern void xf86UnMapDisplay(
    int,
    int
);
extern int xf86ReadBIOS(
    unsigned long,
    unsigned long,
    unsigned char *,
    int
);
extern void xf86ClearIOPortList(
    int
);
extern void xf86AddIOPorts(
    int,
    int,
    unsigned *
);
void xf86EnableIOPorts(
    int
);
void xf86DisableIOPorts(
    int
);

extern Boolean xf86DisableInterrupts(
    void
);
extern void xf86EnableInterrupts(
    void
);

_XFUNCPROTOEND
#endif /* NO_OSLIB_PROTOTYPES */

#endif /* _XF86_OSPROC_H */
